<?
//$date_x=microtime();
                         /*
$DATEDUJOUR = date("D");
IF ($DATEDUJOUR !='Thu' && $DATEDUJOUR!='Mon'){ EXIT;}
                          */
REQUIRE("../../protect/connect_jeu.php");
REQUIRE("../../jeu/fonction.php");


//Faire avancer les transformations.
$query="UPDATE tmp_transformation SET
transformation_tnow=transformation_tnow+transformation_tavancer";
$resultat=mysql_query($query);

$query="SELECT transformation_id,transformation_ress_id,transformation_qqt,transformation_ville
 FROM tmp_transformation WHERE
  transformation_tnow>=transformation_ttotal";
$resultatx=mysql_query($query);

WHILE($tmp2=mysql_fetch_array($resultatx)){

         IF ($tmp2[1]!=1){//Si ce n'est pas des lorin
                    $query="SELECT ville_stock FROM sdville WHERE ville_id=$tmp2[3]";
                    $resultat=mysql_query($query);
                    $tmp=mysql_fetch_row($resultat);

                    $QQT=$tmp2[1]."-".$tmp2[2];
                    //echo $QQT."---";
                    //echo "<br>".$tmp2[4];
                    $TMP=ADD_RESS($tmp[0],$QQT);
                    //echo "<br>".$TMP;

                    $query="UPDATE sdville SET ville_stock='$TMP' WHERE ville_id=$tmp2[3]";

         }ELSE{ //Si c'est des lorins
                    $query="SELECT ville_proprio FROM sdville WHERE ville_id=$tmp2[3]";
                    $resultat=mysql_query($query);
                    $tmp=mysql_fetch_row($resultat);
                    
                    
                      $query="UPDATE sduser_perso SET perso_lorin=perso_lorin+$tmp2[2] WHERE perso_id=$tmp[0]";

         }
         
         
         IF ($resultat=mysql_query($query)){
                           //  echo $query;
                           $query="DELETE FROM tmp_transformation WHERE transformation_id=$tmp2[0]";
                           $resultat=mysql_query($query);
                           // echo $query."<br>";

         }//Fin de IF ($resultat=mysql_query($query)){

}//Fin du while

?>


